<?php

namespace App\Http\Resources\Trip\Orders;

use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
use JsonSerializable;

class PassengerRefundsResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param Request $request
     *
     * @return array|Arrayable|JsonSerializable
     */
    public function toArray($request)
    {
        $refund         = parent::toArray($request);
        $ret            = [];
        $ret["type"]    = $refund["type"];
        $ret["name"]    = $refund["name"];
        $ret["name_uy"] = trans2uy($refund["name"]);
        $ret["fee"]     = $refund["amount"];
        $ret["tip"]     = $cost["tip"] ?? "";
        return $ret;
    }
}
